package com.atguigu.graph;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
class Node{
    public int val;
    public int in; //入度
    public int out; //出度
    public ArrayList<Node> nexts; //点集
    public ArrayList<Edge> edges; //边集
    public Node(int val){
        this.val=val;
        in=0;
        out=0;
        nexts=new ArrayList<>();
        edges=new ArrayList<>();
    }
}
class Edge{
    public Node from; //来源
    public Node to; //去向
    public int weight; // 权重
    public Edge(int weight,Node from,Node to){
        this.weight=weight;
        this.from=from;
        this.to=to;
    }
}
public class Graph {
    public HashMap<Integer,Node> nodes;
    public HashSet<Edge> edges;
    public Graph(){
        nodes=new HashMap<Integer, Node>();
        edges=new HashSet<Edge>();
    }
}
